﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:commands="clr-namespace:Microsoft.Practices.Composite.Presentation.Commands;assembly=Microsoft.Practices.Composite.Presentation" 
	xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 
	xmlns:ic="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions" 
	x:Class="VisualStock.Modules.StockSymbols.AdditionalSymbolInformation.TechnicalIndicatorView">

    <Grid x:Name="LayoutRoot" Width="200" Height="300" Margin="0,0,0,5" RenderTransformOrigin="0.5,0.5">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="VisualStateGroup">
                <VisualStateGroup.Transitions>
                    <VisualTransition GeneratedDuration="00:00:00.4000000">
                        <VisualTransition.GeneratedEasingFunction>
                            <CircleEase EasingMode="EaseOut"/>
                        </VisualTransition.GeneratedEasingFunction>
                    </VisualTransition>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="ShowGetTIView">
                    <Storyboard>
                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="SelectTIView" Storyboard.TargetProperty="(UIElement.Opacity)">
                            <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="GetTIView" Storyboard.TargetProperty="(UIElement.Opacity)">
                            <EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                        </DoubleAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="SelectTIView" Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Collapsed</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="ShowSelectView">
                    <Storyboard>
                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="GetTIView" Storyboard.TargetProperty="(UIElement.Opacity)">
                            <EasingDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="SelectTIView" Storyboard.TargetProperty="(UIElement.Opacity)">
                            <EasingDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                        </DoubleAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="GetTIView" Storyboard.TargetProperty="(UIElement.Visibility)">
                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Collapsed</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>

        <Grid.Triggers>
            <EventTrigger RoutedEvent="Canvas.Loaded">
                <BeginStoryboard>
                    <Storyboard RepeatBehavior="Forever">
                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="textBlock" Storyboard.TargetProperty="(UIElement.Opacity)">
                            <EasingDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
                            <EasingDoubleKeyFrame KeyTime="00:00:04.3000000" Value="0"/>
                            <EasingDoubleKeyFrame KeyTime="00:00:04.6000000" Value="1"/>
                            <EasingDoubleKeyFrame KeyTime="00:00:08.6000000" Value="1"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="symbol" Storyboard.TargetProperty="(UIElement.Opacity)">
                            <EasingDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
                            <EasingDoubleKeyFrame KeyTime="00:00:00.6000000" Value="1"/>
                            <EasingDoubleKeyFrame KeyTime="00:00:04" Value="1"/>
                            <EasingDoubleKeyFrame KeyTime="00:00:04.3000000" Value="0"/>
                            <EasingDoubleKeyFrame KeyTime="00:00:08.6000000" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </Grid.Triggers>

        <Grid.RenderTransform>
            <TransformGroup>
                <ScaleTransform/>
                <SkewTransform/>
                <RotateTransform/>
                <TranslateTransform/>
            </TransformGroup>
        </Grid.RenderTransform>

        <Grid.Effect>
            <DropShadowEffect/>
        </Grid.Effect>

        <Rectangle x:Name="BackgroundFill" RadiusX="5" RadiusY="5">
            <Rectangle.Stroke>
                <LinearGradientBrush>
                    <GradientStop Color="#FFA0A0A0" Offset="0"/>
                    <GradientStop Color="White" Offset="1"/>
                </LinearGradientBrush>
            </Rectangle.Stroke>
            <Rectangle.Fill>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFB4E8FF"/>
                    <GradientStop Color="#FF005A82" Offset="1"/>
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>

        <Grid Margin="2">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid x:Name="Header">
                <Grid.Resources>
                    <Style x:Key="HeaderTextStyle" TargetType="TextBlock">
                        <Setter Property="HorizontalAlignment" Value="Center"/>
                        <Setter Property="FontSize" Value="13.333"/>
                        <Setter Property="VerticalAlignment" Value="Center"/>
                    </Style>
                </Grid.Resources>

                <TextBlock x:Name="textBlock" Text="Technical Indicators" Style="{StaticResource HeaderTextStyle}"/>
                <TextBlock x:Name="symbol" Text="{Binding CurrentSymbol}" Opacity="0" Style="{StaticResource HeaderTextStyle}"/>
            </Grid>

            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="1">
                <Button x:Name="DrawBtn" commands:Click.Command="{Binding DrawCommand}" ToolTipService.ToolTip="At most 4 Technical Indicators can be drawn" Style="{StaticResource SymbolOperationButtonStyle}" Content="Draw">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="MouseEnter">
                            <ic:GoToStateAction StateName="ShowSelectView"/>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>
                <Button x:Name="GetTIBtn" commands:Click.Command="{Binding GetCommand}" Style="{StaticResource SymbolOperationButtonStyle}" Content="Get">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="MouseEnter">
                            <ic:GoToStateAction StateName="ShowGetTIView"/>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>
            </StackPanel>

            <Grid Margin="0,2" Grid.Row="2">
                <ListBox x:Name="SelectTIView" ItemsSource="{Binding TechnicalIndicatorList}" ItemContainerStyle="{StaticResource ComparingSymbolListBoxItemStyle}" ToolTipService.ToolTip="Use CTRL key or SHIFT key to select multiple technical indicators" SelectionChanged="ListBox_SelectionChanged" SelectionMode="Extended" BorderThickness="0" Background="{x:Null}"/>
                <StackPanel x:Name="GetTIView" Opacity="0">
                    <ComboBox Style="{StaticResource ExpressionDarkComboBox}" SelectedItem="{Binding SelectedTechIdctType,Mode=TwoWay}" ItemsSource="{Binding AvailableTechIdctTypes}" Width="Auto"/>
                    <Grid>
                    	<Grid.RowDefinitions>
                    		<RowDefinition/>
                    		<RowDefinition/>
                    	</Grid.RowDefinitions>
                    	<Grid.ColumnDefinitions>
                    		<ColumnDefinition/>
                    		<ColumnDefinition/>
                    	</Grid.ColumnDefinitions>
                    	<TextBox Text="{Binding AnalysisValues[0], Mode=TwoWay}" Margin="5,10,5,0"/>
                    	<TextBox Text="{Binding AnalysisValues[1], Mode=TwoWay}" Grid.Column="1" Margin="5,10,5,0"/>
                    	<TextBox Text="{Binding AnalysisValues[2], Mode=TwoWay}" Grid.Row="1" Margin="5,10,5,0"/>
                    	<TextBox Text="{Binding AnalysisValues[3], Mode=TwoWay}" Grid.Row="1" Grid.Column="1" Margin="5,10,5,0"/>
                    </Grid>
                    <TextBlock TextWrapping="Wrap" Height="150" Margin="0,5,0,0">
					You have the option to draw up to 4 Simple Moving Averages (SMAs) at the same time. 
					The 4 input boxes above represent the days of the Simple Moving Averages you wish 
					to draw. Using the Quick SMA only when you have huge amount of data of this symbol.
					</TextBlock>
                </StackPanel>
            </Grid>
        </Grid>
    </Grid>
</UserControl>
